var express = require('express');
var bodyParser = require('body-parser');
var app = express();

const port = 8000;

//设置模板渲染引擎
app.set('view engine', 'ejs');

//设置视图文件路径
app.set('views', __dirname + '/views');

//设置静态页面目录
app.use(express.static(__dirname + '/public'));

//设置body参数自动向json类型转化
app.use(bodyParser.json());

//设置query参数为string类型body
app.use(bodyParser.urlencoded({
	extended : false
}));

//app.get('/vv', function(req, res){
//	res.render('home.ejs', {name : 'yuri'})
//});

//路由与业务逻辑
app.get('/', function(req, res){
	res.send('test route!');
});

//路由与业务逻辑
app.use('/user', require('./routes/user.js'));
app.use('/query', require('./routes/query.js'));
app.use('/cluster', require('./routes/cluster.js'));
app.use('/manager', require('./routes/manager.js'))
app.use('/test', require('./routes/test.js'));

app.listen(port);